<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/base.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<link href="${ctsCss}/table.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//得到该版本下的所有报表，并拼好字符串
function getAllTemplateName(){
	var annualId = $("#annualId").val();
	var templateId = $("#templateId").val();
	$.ajax({
		url:'${ctx}/reportDesignController/getAllTemplateInfo/'+annualId,
		type:'POST',
		cache:false,
		success:function(data){
			var rptSelectIdOptions = "";
		    $.each(data,function(idx,item){
		    	if(item.templateId == templateId){
		    		rptSelectIdOptions += "<option value='"+item.templateId+"' selected>" + item.templateName + "</option>";
		    	}else{
		    		rptSelectIdOptions += "<option value='"+item.templateId+"'>" + item.templateName + "</option>";
		    	}
			});
		    $("#rptSelectId option").remove();
		    rptSelectIdFirst="<option value='0'>请选择</option>";
		    $(".rptSelectClass").append(rptSelectIdFirst).append(rptSelectIdOptions);
		}
	});
}
$(document).ready(function(){//初始化
	getAllTemplateName();
});
</script>
</head>

<body>
<%@ include file="/common/message-save-general.jsp" %>
<form id="explain-form" class="form-horizontal" action="${ctx}/reportTemplateExplainController/<c:choose><c:when test="${rptTemplateExplain.id == null}">insertExplain</c:when><c:otherwise>updateExplain</c:otherwise></c:choose>" method="post">
	<input type="hidden" id="id" name="id" value="${rptTemplateExplain.id}"/>
	<input type="hidden" id="templateId" name="templateId" value="${rptTemplateExplain.templateId}"/>
	<input type="hidden" id="annualId" name="annualId" value="${rptTemplateExplain.annualId}"/>
<table>
	 <tr class="tab_grey">
	      <td width="25%">报表说明名称：</td>
	      <td width="75%" colspan="3"><input type="text" id="templateExplainName" name="templateExplainName" value="${rptTemplateExplain.templateExplainName }" required maxlength="50" style="width:150px" maxlength='50' /></td>
     </tr>
     <tr class="tab_grey">
	     <td width="25%">所属报表：</td>
	      <td width="75%">
	      	<select id="rptSelectId" style="width:150px;margin-left:0px;" class="rptSelectClass"></select>
	      </td>
     </tr>
     <tr class="tab_grey">
      <td width="25%">报表说明类型：</td>
      <td width="75%" colspan="3">
      	<gdata:select items="${codedic['10013']}" id="explainType" name="explainType" value="${rptTemplateExplain.explainType}" headerKey="请选择" cssStyle="width:150px"/>
      </td>
     </tr>
     <tr class="tab_grey">
      <td width="15%">排序：</td>
      <td width="85%" colspan="3">
      	<input type="text" id="orderId" name="orderId" value="${rptTemplateExplain.orderId }" class="number" maxlength="5" style="width:150px" maxlength='4' />
      	注：只能填数字，数字越大，排序越靠前
      </td>
     </tr>
</table>
<div  style="text-align: center;">
	<button type="button" class="btn btn-primary" id="saveBtn" onclick="explainSaveInfo();">保存</button>
	<button type="reset" class="btn" id="resetBtn">重置</button>
</div>
</form>
</body>
<script type="text/javascript">
$('#explain-form').validate();
function explainSaveInfo(){
	var rptSelectId = $("#rptSelectId").val();
	$("#templateId").val(rptSelectId);
	$("#explain-form").submit();
}

</script>
</html>
